Mapa de casos de covid-19 en Costa Rica, para el viernes 22 de octubre del 2021
fallecidos_rl <- raster::raster(fallecidos)
bins <- c(10, 100, 500, 1000, 4000, 7600)
pal <- colorBin("YlOrBr", domain = casos$activos, bins = bins)
bins3 <- c(1, 5000, 10000, 20000, 40000, 52000)
pal3 <- colorBin("Reds", domain = casos$positivos, bins = bins3)
at <- seq(1:800)
pal2 <- colorBin('Accent', domain = at , na.color = "transparent")
leaflet() %>%
addTiles(group = "OSM") %>%
addProviderTiles(providers$Esri.NatGeoWorldMap , group = "NatGeo") %>%
addProviderTiles(providers$CartoDB.DarkMatter, group = "CartoDB-Black") %>%
addRasterImage(fallecidos_rl,
opacity = 1,
group = "Fallecidos",
colors = pal2) %>%
addLegend("bottomleft",
pal = pal2,
values = at,
title = "Fallecidos") %>%
addPolygons(
data = casos,
color = "black",
fillColor = ~ pal(activos),
fillOpacity = 1,
weight = 1,
opacity = 1,
stroke = TRUE,
group = "Casos Activos",
popup = paste0("<b>Cantón: </b>", casos$canton, "<br>", "<b>Casos activos: </b>", casos$activos)
) %>%
addLegend(
pal = pal,
values = casos$activos,
opacity = 1,
title = "Casos Activos"
) %>%
addPolygons(
data = casos,
color = "black",
fillColor = ~ pal3(positivos),
fillOpacity = 1,
weight = 1,
opacity = 1,
stroke = TRUE,
group = "Casos Positivos",
popup = paste0("<b>Cantón: </b>", casos$canton, "<br>", "<b>Casos positivos: </b>", casos$positivos )
) %>%
addLegend(
pal = pal3,
values = casos$activos,
opacity = 1,
title = "Casos Positivos"
) %>%
addLayersControl(
"bottomleft",
baseGroups = c("OSM", "NatGeo", "CartoDB-Black"),
overlayGroups = c("Fallecidos", "Casos Activos", "Casos Positivos" ),
options = layersControlOptions(collapsed = TRUE)
) %>%
addScaleBar("bottomright") %>%
addMiniMap() %>%
addResetMapButton() %>%
addFullscreenControl()
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137
## +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null
## +wktext +no_defs +type=crs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum World Geodetic System 1984 in Proj4 definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137
## +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null
## +wktext +no_defs +type=crs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum World Geodetic System 1984 in Proj4 definition